package com.bkgy.modular.tpdodata_cal2150.converter;

import com.bkgy.modular.tpdodata_cal2150.entity.TPdoDataCal2150;
import com.bkgy.modular.tpdodata_cal2150.entity.TPdoDataCal2150_bao;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * 宝信实体转换器
 */
@Mapper(unmappedTargetPolicy = org.mapstruct.ReportingPolicy.IGNORE,
        unmappedSourcePolicy = org.mapstruct.ReportingPolicy.IGNORE,
        builder = @org.mapstruct.Builder(disableBuilder = true),
        nullValuePropertyMappingStrategy = org.mapstruct.NullValuePropertyMappingStrategy.IGNORE,
        nullValueCheckStrategy = org.mapstruct.NullValueCheckStrategy.ALWAYS,
        componentModel = "default",
        injectionStrategy = org.mapstruct.InjectionStrategy.CONSTRUCTOR)
public interface TPdoDataCal2150Converter {

    TPdoDataCal2150Converter INSTANCE = Mappers.getMapper(TPdoDataCal2150Converter.class);

    @Mapping(source = "extid", target = "extid") //连退出口卷号，直接映射
    @Mapping(source = "entid", target = "entid") //连退入口卷号，直接映射
    @Mapping(source = "ext_thich", target = "out_mat_thk") //出口厚度，
    @Mapping(source = "ext_weight", target = "out_mat_wt") //出口重量，从宝信系统重量字段映射
    @Mapping(source = "ext_length", target = "out_mat_len") //出口长度，从宝信系统长度字段映射
    @Mapping(source = "ext_diaminner", target = "out_mat_inner_dia") //出口内径，从宝信系统内径字段映射
    @Mapping(source = "ext_diamout", target = "out_mat_outer_dia") //出口外径，从宝信系统外径字段映射
    @Mapping(source = "ext_width", target = "out_mat_width") //出口宽度，从宝信系统宽度字段映射
    @Mapping(source = "shift", target = "shift") //班次，直接映射
    @Mapping(source = "crew", target = "crew") //班组，直接映射
    @Mapping(source = "steelgrade", target = "steelgrade") //钢种，直接映射
    @Mapping(source = "c_credate", target = "credate") //创建日期，直接映射
    @Mapping(source = "n_repairflag", target = "repairflag") //返修标志，
    @Mapping(source = "c_repairtype", target = "repairtype") //返修类型，直接映射
    @Mapping(source = "n_sleevemode", target = "sleevemode") //套筒模式，
    @Mapping(source = "n_cutcnt", target = "cutnum") //剪切次数，
    @Mapping(source = "n_cutpos", target = "cutpos") //剪切位置，
    @Mapping(source = "n_spmrough", target = "spmrough") //平整粗糙度，
    @Mapping(source = "c_prelinecode", target = "preprocess") //前道工序代码，直接映射
    @Mapping(source = "c_nextlinecode", target = "nextprocess") //后道工序代码，直接映射
    @Mapping(source = "n_sleevewt", target = "sleevewt") //套筒重量，
    @Mapping(source = "n_sleevethk", target = "sleevethk") //套筒厚度，
    @Mapping(source = "c_flatcode", target = "flatcode") //平坦度代码，直接映射
    @Mapping(source = "c_spmcustcode", target = "spm_mode") //平整方式代码，直接映射
    @Mapping(source = "c_dfctcode1", target = "defect_code1") //缺陷代码1，直接映射
    @Mapping(source = "c_dfctcode2", target = "defect_code2") //缺陷代码2，直接映射
    @Mapping(source = "c_dfctclass1", target = "defect_class") //缺陷等级，直接映射
    @Mapping(source = "c_memo1", target = "prod_start_time") //开始生产时间，从宝信系统备注字段映射
    @Mapping(expression = "java(com.bkgy.util.DateUtil.getdatetostring(bao.getToc()))", target = "toc") //原表创建时间，日期类型转字符串
    @Mapping(expression = "java(com.bkgy.util.DateUtil.getdatetostring(bao.getTom()))", target = "tom") //修改时间，日期类型转字符串
    @Mapping(source = "mop", target = "mop") //修改人，直接映射
    @Mapping(source = "mou", target = "mou") //修改人部门，直接映射
    @Mapping(source = "hot_coil_id", target = "hot_coil_id") //热轧卷号，直接映射
    @Mapping(target = "in_mat_thk", source = "ext_thich") //入口厚度
    @Mapping(target = "in_mat_width", source = "ext_width") //入口宽度
    @Mapping(target = "in_mat_wt", source = "ext_weight") //入口重量
    @Mapping(target = "in_mat_len", source = "ext_length") //入口长度
    @Mapping(source = "heatno", target = "heatno") //退火曲线，直接映射
    @Mapping(target = "heatno_grade", ignore = true) //炉号钢种，bao对象中无对应字段
    @Mapping(target = "exthk_aim", source = "ext_thich") //目标厚度，使用出口厚度
    @Mapping(target = "exwidth_aim", source = "ext_width") //目标宽度，使用出口宽度
    @Mapping(target = "exlen_aim", source = "ext_length") //目标长度，使用出口长度
    @Mapping(target = "exwt_aim", source = "ext_weight") //目标重量，使用出口重量
    @Mapping(source = "oiltype", target = "oiltype") //涂油种类，直接映射
    @Mapping(source = "oilcode", target = "oilcode") //涂油代码，直接映射
    @Mapping(source = "oilamount", target = "oilamount") //涂油量，直接映射
    @Mapping(source = "elong_aim", target = "elong_aim") //延伸率目标值，直接映射
    @Mapping(source = "enthk_class", target = "enthk_class") //入口厚度分档代码，直接映射
    @Mapping(source = "exthk_class", target = "exthk_class") //出口厚度分档代码，直接映射
    @Mapping(source = "enwidth_class", target = "enwidth_class") //入口宽度分档代码，直接映射
    @Mapping(source = "exwidth_class", target = "exwidth_class") //出口宽度分档代码，直接映射
    @Mapping(source = "yp_class", target = "yp_class") //钢种分档代码，直接映射
    @Mapping(target = "create_time",  expression = "java(new java.util.Date())") //创建时间
    @Mapping(target = "indocno", ignore = true) //文档编号，宝信系统中无对应字段
    TPdoDataCal2150 toTPdoDataCal2150(TPdoDataCal2150_bao bao);
}